**** PRINT OUT THIS PAGE ****
This is Webteacher's Webdata, version 2.27 Last modified
on July 19, 1998.
Standard Disclaimer:
The authors, resellers, and distributers are not responsible for any
loss of information, time, resources, business, hardware, software, or
any damages resulting from the use of this program. As with any database,
information should be backed up regularly, and the program should be tested
thoroughly before using it for real world purposes. Use Webteacher's Webdata
at your own risk.
New Modifications
Modifications in 2.27c
A Perl 5 function was removed to allow Webdata to run under Perl 4 again
A bug has been fixed which prevented the 'Return to Administration Page' link
from working when no records were found.
Modifications in 2.27b
The cuseom search header was stripping any lines after a carraige return. This has been fixed.
Modifications in 2.27a
An upgrade program has been included with this version. It only works with version 2.26. To use, upload webdata.cgi and upgrade.pl to the server. Telnet in and type:
perl upgrade.pl webdata_[dbname].cgi
A bug has been fixed which sometimes caused problems when members logged in.
Users and administrators can go to any results page with numbered links at the bottom of large search results.
Custom search pages that use the "multiple selections" option on select lists will be received by the search engine as "first item or second item".
Searches that return no results now display "No records found" instead of a blank table.
Administrators can now add custom HTML to the default search form.
Administrators can now choose whether to display the search instructions on the default search form.
Modifications in 2.26
A bug has been fixed which caused the boolean searches to fail sometimes.
A different sorting algorythm has been implemented to speed up the
sort process.
The Admin and Member search results now show only 20 results at a time.
Modifications in 2.25
A bug has been fixed which sometimes caused the member ID to be offset
by one field.
Fields containing *.gif or *.jpg are automatically converted to <IMG
SRC="*.gif"> in user search results
Checkboxes now store the word "yes" instead of the Netscape default
of "on".
Redefine field button now retains old values in prompt boxes.
The installer now creates a unique ID for registration purposes.
Modifications in 2.24
A bug was fixed which caused links and URLs not to show on some servers.
A bug was fixed which caused images and other HTML with quotes not
to work in the VIEW page.
Modifications in 2.23
A bug was fixed which caused add and search errors in fields who's
name contained special characters.
Modifications in 2.22
A bug was fixed which caused some member entries to lose the last field.
Modifications in 2.21
A bug has been fixed which was causing errors in date searches.
The program now recognizes xx/xx/xx?? as a date, and automatically
converts both field values and search criteria to 4 digit years (year 2k
for years less than 20).
The "and" and "or" criteria now work in the admin searches.
A "view" button may now be displayed on each record to display the
record in a columnar form page.
Choose whether or not to use this feature on the "Customize
Report" page.
Modifications in 2.2
Fields now can be defined as text, checkbox, or selection list.
JavaScript has beed added to the modify fields page to assist in creation
of new fields.
e-mail (*@*.*) and URLs (http://*) are automatically converted to links.
Modifications in 2.1
Administrators can now change the color, header text,
field sequence, and sort order of user search results table.
A Customize Reports button has been added to the Administration
page.
The reports page has a box for an HTML color or Hex Triplet
(#RRGGBB)
The reports page has a large textarea for header code.
This can contain HTML tags including links and images.
Admins can click the available fields to choose the sequence
of columns in the report table. This also allows
users to omit fields which they would like to leave hidden.
Admins can select the field by which they would like
to sort.
Customized User Search pages are no longer restricted
by sequence, they are driven by fieldname.
Default input boxes have been expanded to 60 characters.
A 'Delete Found Set' button has beed added to the Administration
Search Results, allowing the administrator to delete multiple records.
Modifications in 2.0
A bug has been fixed which prevented MSIE4 users from
adding records.
The installer now asks whether visitors should be allowed
to add records.
The installer now asks whether visitors should be allowed
to search for records.
A bug has been fixed which caused user searches to sometimes
be added.
The default line in the data file is now visible so that
it can be deleted once data is added
The Admin can now create 'member' accounts in which members
can enter a unique password and add, modify, or delete only their own records.
The readme now includes instructions for remote installation
without telnet access.
Welcome
and thank you for purchasing WEBDATA, the first easy database CGI for the
web.
Before you run the installer program, you will need to complete this
worksheet. It will be easiest
to write on a printout of this page before running the installer. There
is an explanation of each question below the form.
The installer will prompt you for this information. If you are
unsure about any of this, you should contact your
system administrator.
Windows users, you only
need to answer the questions marked with a [W].
Read the special Windows instructions in Italics
below.
[W]1. Choose a short name
for this database.
2. CGI scripts are stored:
___ 1. only in the cgi-bin directory
___ 2. in any directory, so long as the filename ends with .cgi
[W]3. If you answered 1 above
or you are running Windows NT, what is the path to the cgi-bin
4. What is the path to Perl?
[W]5. What URL would you like
to link to at the bottom of each page when the user clicks on "Return to
Homepage"
[W]6. What would you like
your password to be?
[W]7.
Would you like visitors to be able to ADD entries to the database (y/n)?
[W]8.
Would you like visitors to be able to SEARCH the database (y/n)?
[W]9. How many search results
would you like to display at one time?
[W]10.
What fields would you like in your database. For example, FirstName,
LastName, Address, City, State, Zip for a mailing list;
or for a Car Lot, you may enter VIN,
make, model, year, color, doors, condition, ammenities, price
It will be quite a bit more difficult to add or remove
field names after you have entered them in, so put some thought
into this. Be sure you include all the fields,
and in the order in which you want them displayed. Keep the names
short and simple.
FIELDS |
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________ |
|
________________________
.
|
When you have completed this worksheet,
create a directory under your homepage directory
called webdata. Move the 2 files,
uinstall.pl
webdata.cgi
into the webdata directory.
IMPORTANT: Be sure your FTP program is set to ASCII mode.
Use your telnet program to connect to your server, and go to the webdata
directory. For a quick introduction to navigating Unix, see page 1 of webteacher.com's
CGI tutorial at http://www.webteacher.com/perltour
[If you do not have telnet access, See the instructions for manual installation
--GO THERE]
Type
perl uinstall.pl
Answer the questions using this worksheet. When you are done,
you can point your browser
to webdata/[dbname]_admin.html to begin adding
records. Where [dbname] is the name you chose in question #1.
You may wish to bookmark that page.
Create a link on your homepage to webdata/[dbname]_form.html
for your guests. This page allows readers to search (and add
to if you selected it) the database, but not modify it.
Windows users:
Create a folder in your homepage folder called
'webdata'
Move thest two files into your webdata folder
winstall.pl
webdata.cgi
You must have Perl installed on your server
to run Webdata or the installer. You can
download Perl for free from this site.
http://www.ActiveState.com/software/Perl_for_Win32.htm
Double click on the winstall.pl icon.
A DOS window should appear with some text. If
you have difficulty, be sure the ".pl" extension
is associated with Perl. You can also
launch the winstall.pl program by opening
a DOS prompt, cd to the webdata directory,
and type 'perl winstall.pl' .
Answer the questions using this worksheet.
*****************************************************************************************************
DETAILS ABOUT THE INSTALLATION
QUESTIONS
1. Choose a short name for the database
The name you choose will be used in each of the files used by your database.
This will allow you to install more than 1 database on your website.
If you choose 'cars', for example, the user form will initially be named
'cars_form.htm'. The administration page will be named 'cars_admin.htm'.
The data is stored in a hidden file called '.cars_data.log' and the fieldnames
are kept in another hidden file called '.cars_fields.log'. The program
copied into the cgi-bin will be named 'webdata_cars.cgi'.
You may change the names of the 2 .htm pages if you wish, but not the
log files or the cgi.
2. Do CGI scripts have to go in the cgi-bin directory?
If you have never installed a cgi script, I highly suggest e-mailing your
system administrator with questions 2,3,&4.
In some cases, you will be required to use a special directory which
is not named cgi-bin. If you have been designated
a special directory other than cgi-bin for your cgi scripts, here is what
you should do.
-
Choose Option 1 for this question.
-
Enter the path to your special CGI directory for question 3.
-
After the installation is complete, you will need to open the two HTML
files in the webdata directory. They are named [dbname]_form.html,
and [dbname]_admin.html. In each of these files you
will find a path to the cgi script in the <FORM> tag near the top.
It will look like this: <FORM ACTION="/cgi-bin/webdata_[dbname].cgi">
-
Adjust the path next to ACTION= so that it points to your
custom cgi directory.
The only way to answer this question without the help of your system
adminsitrator is to try running a simple CGI, and see if it works. Follow
these steps:
-
Open a telnet
session to your web server.
-
Go to question 4, get the path to Perl on your system.
-
Copy the following text to a simple text editor such as Notepad.
#!/usr/bin/perl
#
print "Content-type: text/html\n\n";
print "<H1>Hello World</H1>";
-
Replace the words /usr/bin/perl with the path to Perl on YOUR
system.
-
Save the file as hello.cgi
-
Upload hello.cgi to your web server
(Be sure the FTP program is set to ASCII,
not binary mode)
-
Change to the directory
on your server which contains hello.cgi.
-
Type chmod a+rx hello.cgi and press [ENTER].
Point your browser to hello.cgi the same way you would to view an html
page.
-
If all 4 lines of the program appear on the screen, the answer is 1 - cgi
scripts must live in a cgi-bin directory. Check option 1 and proceed to
question 2 to find the cgi-bin.
-
If Forbidden or Permission Denied appears on the screen, type the chmod
command again. If it still appears, the answer is 1 - cgi scripts must
live in a cgi-bin directory.
-
If Hello World appears on your screen, the answer is 2 - CGI scripts can
live anywhere, so long as the name ends with .cgi.
-
If Server Error appears on your screen there is a mistake in the code,
or it was not uploaded in ascii mode. Either way, since the program even
tried to run, the answer is 2 - CGI scripts can live anywhere, so
long as the name ends with .cgi.
3. Locating the /cgi-bin/ directory
From a command prompt, type this command:
find / -name cgi-bin -print |& grep -v denied
[W]Windows users - you know where your file
search tools are.
This may take over 10 (or even 20) minutes to run, it is searching the
entire server. The pipe character | is a vertical line, usually located
on the right side of the keyboard above the [ENTER] key. It may appear
as 2 lines above each other. It is frequently [SHIFT]+Backslash[\].
4. Locating the Perl program
The first line of every Perl program gives the location of Perl on the
system. This is so a command from an outside web page will instantly
know what program to execute, and where to look for it.
From the command prompt, type which perl and press
[ENTER].
Hopefully, the system returned a line similar to this:
/usr/bin/perl
or
/usr/local/bin/perl
Write down the result. This is the location of Perl on your system,
and you will need it.
If the system did not return a result, try this:
Type whereis perl and press [ENTER].
Again, you are looking for a path similar to the ones described above.
You may get several results, but only one should end with just perl
and nothing else. Write down the result if you get one.
If you still do not have the path to Perl, you will need to e-mail your
system administrator.
5. What URL would you like to link to on "Return to Homepage?"
[W] read this...
The CGI will generate a link at the bottom of every window called 'Return
to Homepage.' This does not necessarally have to be your welcome
page. If you have an index or central page which is more useful you
may wish to enter that address here.
Be sure to type the entire URL, for example, http://www.webteacher.com/javatour/framehol.htm
6. What would you like your password to be?
[W] read this...
I'm trying to think of anything to put here, really. The question is
very straightforward.
7. Would you like visitors to be able to ADD entries to the database?
[W] read this...
If you are using Webdata for a guestbook, survey, or order form then
you will need to give visitors the ability to add records to the database.
If you are displaying an on-line catalogue, on the other hand, you will
want to restrict access to the database.
8. Would you like visitors to be able to SEARCH the database?
[W] read this...
In some cases, you may wish to allow visitors to add entries, but not
to search the entire database. Order forms and confidential surveys
are not for public viewing, and you will choose NO to restrict access.
9. How many search results would you like to display at one time?
[W] read this...
If you accept the default of 15, and the user's search displays 43
results, then results 1-15 will appear on the first page with a button
called "NEXT".
Clicking on "NEXT" will display results 16-30, etc.
15 is a good number for single line results, such as names and phone
numbers. If you plan to include comments, descriptions, biogrophies,
resumes, pictures, or anything else that will make the result lines wider
than 1 line, you may wish to choose a smaller number. You can always
change this later by changing the number on line 14 in the cgi script.
10. What field names would you like in your database?
[W] read this...
You will want to plan your field list carefully before installing.
Talk to as many people as you can. Find out what kinds of things
people will want from the database. At the same time, remember that
the display will be an HTML table. If you try to cram 35 columns
onto a line, you'll get a lot of tall skinny cells with one or two letters
on each row.
You do not need to create a primary key. The program secretly
indexes each record with a unique number.
MANUAL INSTALLATION
If you do not have telnet access, you can still install webdata. You will
need to run the installer on your PC, then change certain lines in the
script and html pages. Finally, you will need to use your ftp program to
chmod (change the access rights) after you upload the files.
-
You will need to have Perl installed on your PC to run the
installer. You can download Perl for free from http://www.perl.com
-
Double click on the icon labeled "uinstall.pl". A DOS window
should open with the installer running. Answer the questions as you would
on your server. NOTE:For question 3, Where will the CGI scripts
live on your server? Regardless of how your server is set up, answer
with 2.
-
If CGI scripts can live in any directory,
-
Open the webdata_[dbname].cgi file, and remove any pathname
information before the filenames of the 3 log files (lines 11,12,13). For
example, I would change
$logfile='/cars_data.log';
to read
$logfile='cars_data.log';
-
Create a folder on your server under your homepage directory
called Webdata.
-
Upload all files that contain [dbname](name you chose during
install) in their name to the Webdata directory.
-
Proceed to step 5.
-
If CGI scripts go in the cgi-bin directory, Make the
following changes.
-
In the [dbname]_admin.html and [dbname]_members.html files,
locate the <FORM> tag and change
ACTION="webdata_[dbname].cgi"
to read
ACTION="/cgi-bin/webdata_[dbname].cgi"
-
In the [dbname]_form.html files, change the location
location.replace('webdata_[dbname].cgi...
to read
location.replace('/cgi-bin/webdata_dbname.cgi...
-
Create a folder on your server under your homepage directory
called Webdata.
-
Determine the server path to the Webdata directory. This
often appears under properties, or PWD in your FTP program. It might look
like this:
/home/~yourname/htdocs/webdata
-
Open the webdata_[dbname].cgi file, and change the location
of the 3 log files (lines 11,12,13) to match this new location. For example,
to use the path above, I would change
$logfile='/cars_data.log';
to read
$logfile='/home/~yourname/htdocs/webdata/cars_data.log';
-
Upload the webdata_[dbname].cgi file to the cgi-bin directory
-
Upload all other files with [dbname] in their filenames to
the Webdata Directory.
-
Change the privilages as follows:
-
chmod 755 webdata_[dbname].cgi (users->all, groups and others
can read and execute)
-
chmod 777 the Webdata directory (everyone has everything)
-
chmod 777 all the .log files
-
chmod 755 all the .html files
Customizing Webdata
There are 2 pages that the general public will see, the user search page,
and the search results.
To Customize the User Search page
The page you will link users to is called [database name]_form.html.
It will automatically query the Webdata CGI to read your list of fieldnames,
and generate a search form "on-the-fly." The advantage to this method
is that if you should change your list of fields, the user search form
will automatically reflect those changes. The disadvantage is that
it creates a rather plain beige screen, without your site's text and graphics.
You can save this page and modify it to match the look and feel of your
site.
-
Point your browser to [dbname]_form.html
The program should create a user search form.
-
Choose SAVE AS from the FILE menu, and choose a name and location for the
custom form. For example, you may call it "search.html"
-
Open the CGI script, and locate the definition of "$searchpage" at line
17.
$searchpage="$cgilocation?cgifunction=user";
Replace the contents of the quotes with the URL of your custom search
page, so if your URL is at www.mypage.com and the webdata folder is right
under the homepage, then the line might look like this:
$searchpage="http://www.mypage.com/webdata/search.html";
-
Open the custom form you just saved in any text editor and make changes.
You may add titles, images, and text anywhere you wish. There are
just a few rules you need to keep in mind:
-
If your server uses a cgi-bin, you will need to redefine the "ACTION="
in the <FORM> tag.
Replace the text
ACTION="webdata_[dbname].cgi"
with
ACTION="/cgi-bin/webdata_[dbname].cgi"
-
Do not change the names of the fields. They must be identical (case sensitive)
to the field names as they appear on the administration page.
If you would like a more in-depth description with examples, check out
the tutorial, later in this page.
To customize Search Results
Go to the [dbname]_admin.html page, enter your password. When the administration
page loads, click on 'Customize Report'. Here you can change the color,
add header HTML code, select which fields to display in what column sequence,
choose a sort order, number of results per page, and whether to display
the "view" button. When you have made your selection, click 'Modify Report'
and wait for the page to reload. Then follow the link to the user's search
page to see your modifications.
The "view" button is a good tool for databases that have a lot of fields.
If you cannot display all of the information in a single row of the results
table, simply choose only the 3 or 4 most descriptive fields in the "column-sequence"
box. Then, check the "view button" checkbox. When a user searches
your database, he/she will see a concise list of search results, each with
a "view" button. Clicking on the "view" button will display all the
information about that record.
Instructions for
general use
Webdata has been designed to be extremely self-explanatory. Most
user instructions are included on the ADD and SEARCH web pages themselves.
You may wish to refer to the download
page, which is loaded with screenshots and basic instructions for using
Webdata.
Creating lists, comment boxes, checkboxes and
resized text boxes
Now in version 2.2 you can define your fields as lists, comment boxes
or checkboxes, or define the size of text boxes. Simply click on
'Modify Fields' on the Admin page. Then, select the field you want
to change, and click 'REDEFINE SELECTED FIELD'. Enter the Name of
the field (change it or keep it the same, it doesn't matter), and click
OK. Then enter the word list, comment, checkbox, or text, and click
OK. Finally, for lists, you will be prompted to enter the list values in
a comma seperated format. For text boxes, you will be prompted to
enter the size. For comment boxes, you will be prompted to enter how many
rows you would like (column width is 60 characters).
Adding Members
You can create members of your database. These people will each have
their own password, and they will be able to add records, and to delete
and modify only the records that they have added.
On the main administration page, accessed from [dbname]_admin.html,
there is a button called "members." Click this button to enter a
screen with a list of existing members in the top half, and two boxes for
creating a new member and password in the bottom half. To remove
a member, select the member in the top half and click the 'delete' button.
If a member forgets his/her password, delete the member, then create the
account again, being careful to type the username exactly the same way.
Members can go to the [dbname]_members.html page to gain
access to their records.
NOTE: Both the administration pages and the member pages use cookies
to avoid prompting for a password more than once. The cookies will
expire each time you exit your browser. If you are logged in as an
administrator, and you wish to test the member pages, you will need to
restart the browser to see the effects. Members that share a terminal
should be warned to exit the browser when they are finished.
Adding pictures and links
The search results are displayed inside an HTML table. All HTML commands
will work inside the table with the exception of SSI
. You can display a word in bold by simply typing <B>my
text</B>.
Now in version 2.25, a field that contains only a URL will automatically
be converted to an <A HREF> link when the user search is displayed.
A field that contains only an e-mail address will will be converted
to a mailto: link.
A field that contains only a string of text ending with .gif or .jpg
will automatically be converted to an <IMG> tag.
To add a picture, you may use either an absolute URL (begins with http://)
or a filepath relative to the cgi script. So, for example, if my
website looked like this:
myaccount (at http://www.myaccount.com)
/ \
htdocs cgi-bin
/ \
|
images webdata
webdata_[dbname].cgi
|
duck.gif
swan.gif
goose.gif
I could enter the image either of these 2 ways.
http://www.myaccount.com/images/duck.gif
or
../htdocs/images/duck.gif
NOTE: You may still enter an <IMG> tag manually if you would like
to add special parameters such as "width=72" or "border=2".
Technical Notes
8 Files are created by the installer.
-
[dbname]_form.html - This page uses the location.replace() JavaScript method
to forward the visitor to the correct CGI location without disabling the
BACK button. If you do not wish to use JavaScript, make a copy of
the CGI results from this page. See 'Customizing
Webdata' above for instructions.
-
[dbname]_admin.html - This page prompts the user for a password, then calls
the CGI to return the main Administration page.
-
[dbname]_members.html - This page prompts members for a username and password,
then calls the members page, from which members can add or modify their
own entries, but not any other records.
-
[dbname]_members.log - This file stores the username and passwords for
member accounts. The passwords are encrypted with Perl's crypt()
function.
-
index.htm - This page simply forwards the user to the [dbname]_form.html
page. Feel free to replace it with any welcome information you wish.
It is created primarally as a security measure prevent users from seeing
the contents of your webdata directory.
-
[dbname]_fields.log - This is your list of fields. You should never
need to open this file. The field list should be edited with the
'MODIFY FIELDS' button on the main administration page to ensure that the
proper sequence is maintained. The format for each field is the fieldname,
then a double colon, then the field type (text, checkbox, or list), then
a single colon, then for text boxes the number of characters, for lists,
a comma delimited list of values.
-
[dbname]_report.log - This contains the page color of your user search
form and search results, any header HTML, the sequence of fields, the field
number for sorting, and the number of results per page.
-
[dbname]_data.log - This is the delimeted text file of all of your data.
If for some reason you find that you need to make an edit without using
the Webdata interface, you may open this file in any (plain) text editor
and make your changes. For example, if you wish to change a large
quantity of records at one time, it will be faster to use MS Word's auto-replace,
than to select and delete each one individually in Webdata. You should
always backup a log file before making changes to it.
-
webdata_[dbname].cgi - This is the main engine of the database. The
database name appears at the end so that multiple Webdata programs will
be clustered together in the cgi-bin. Here is a brief synopsis of
how the program works:
Every time the Webdata program is called, it uses the readparse
subroutine to import the CGI data and assign it to the $user_data{} and
@value array.
It then assigns the user customized variables located in lines 7-15.
This tells the program the correct location of the datafiles, the password,
the name of the cgi program, and where to send the homepage links, where
to send the "search again" link for users, and how many results to display
to users.
The program then executes one of the 18 subroutines, depending on the
value of "cgifunction".
NOTE: THE FOLLOWING INSTRUCTIONS INVOLVE MINOR
CHANGES TO THE WEBDATA.CGI PROGRAM. YOU SHOULD
ALWAYS BACKUP THE PROGRAM BEFORE ATTEMPTING TO MAKE MODIFICATIONS.
DISABLING THE PASSWORD FOR CERTAIN FUNCTIONS
Most of the subroutines begin by calling the checkpass routine,
which checks for the presence of a password cookie. You can open
that function to visitors by removing the "&checkpass" or "&memberpass"
near the top of the subroutine. memberpass is open to all members but not
visitors. checkpass is only open to administrators.
EUROPEAN DATES
Near the bottom of the program is a function called 'datetonum'.
Search for the words 'sub datetonum' and find the line 10 lines below it
which reads
#FOR EUROPEAN DATES COMMENT OUT THE LINE ABOVE AND UNCOMMENT THE LINE
BELOW
Do as it says, and the program will translate the dates dd/mm/yy instead
of mm/dd/yy. Note: The program is year 2000 compliant, with automatic
conversion for years less than 20. For example, 3/3/68
is March 3, 1968. but 3/3/01 is March 3, 2001.